Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antv/g-base

Package Overview
Dependencies
Maintainers
23
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/g-base

A common util collection for antv projects

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
23
Created

What is @antv/g-base?

@antv/g-base is a foundational graphics library that provides basic functionalities for creating and manipulating graphical elements. It is part of the AntV ecosystem, which is a suite of data visualization tools developed by Ant Financial. The library offers a set of APIs for drawing shapes, handling events, and managing the lifecycle of graphical objects.

What are @antv/g-base's main functionalities?

Drawing Shapes

This feature allows you to draw basic shapes like circles, rectangles, and lines. The code sample demonstrates how to create a canvas and draw a red circle on it.

const { Canvas } = require('@antv/g-base');
const canvas = new Canvas({ container: 'container-id', width: 500, height: 500 });
const circle = canvas.addShape('circle', { attrs: { x: 100, y: 100, r: 50, fill: 'red' } });
canvas.draw();

Event Handling

This feature enables event handling for graphical elements. The code sample shows how to add a click event listener to a circle shape.

circle.on('click', () => { console.log('Circle clicked!'); });

Transformations

This feature provides methods for transforming shapes, such as translating, scaling, and rotating. The code sample demonstrates how to apply these transformations to a circle.

circle.translate(50, 50);
circle.scale(2, 2);
circle.rotate(45);

Other packages similar to @antv/g-base

Keywords

FAQs

Package last updated on 14 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc